﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Xml;
namespace Wys.ClosePopup
{
    public class ClosePopupIConfigurationSectionHandler : IConfigurationSectionHandler
    {        
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            List<CClosePopupSection> lst = new List<CClosePopupSection>();
            XmlNode xn = null;
            for (int i = 0; i < section.ChildNodes.Count; i++)
            {
                xn = section.ChildNodes[i];
                if (xn.Name == "FindElement")
                {
                    CClosePopupSection cps = new CClosePopupSection();
                    try
                    {
                        cps.DllName = xn.Attributes["DllName"].Value;
                    }
                    catch (Exception) { }
                    try
                    {
                        cps.ClassName = xn.Attributes["ClassName"].Value;
                    }
                    catch (Exception) { }

                    try
                    {
                        cps.FindTitleString = xn.Attributes["FindTitleString"].Value;
                    }
                    catch (Exception) { }
                    
                    lst.Add(cps);
                }
            }
            return lst;
        }
    }
}
